<?php
/**
 * ExtFileUploadFieldBase class file
 *
 * @author TrueSoftware B.V. (The Netherlands)
 * @link http://www.ext4yii.com
 * @copyright Copyright 2007-2010 TrueSoftwareB.V. all rights reserved.
 * @license http://www.ext4yii.com/license/
 *          EVALUATION VERSION - NOT FOR COMMERCIAL USE OR DISTRIBUTION.
 * @version 0.7.2
 */
class ExtFileUploadFieldBase extends ExtTextField
{
    private $_buttonconfig_class_types = array('ExtButton');

    public function init()
    {
        parent::init();
        $this->getController()->addUxCss('fileuploadfield/css/fileuploadfield.css');
        $this->getController()->addUxScript('fileuploadfield/FileUploadField.js');
    }
    
    public function parseNode(ExtHTMLParserNode $node,
        ExtASTWalker $astwalker)
    {
        parent::parseNode($node, $astwalker);
        $this->parseButtonConfig($node, $astwalker);
    }

    private function parseButtonConfig($node,$astwalker)
    {
        $bconf = $node->findPropertyByName('buttonconfig');
        if(!is_null($bconf))
        {
            $items=parent::parseNodeWidthTag($bconf,
                $astwalker,
                true,
                array('asobject'=>false),
                $this,
                $this->_buttonconfig_class_types);
            $this->setJavaScriptConfig('buttonCfg', $items[0]);
            $bconf->shiftUp();
        }
    }
}
?>
